package com.shujia.dao;

import com.shujia.entity.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmpDao {
    //查询全部的员工信息
    @Select("select * from emp")
    List<Emp> findAll();

    //新增数据
    @Insert("insert into emp (empno,ename,job,mgr,hiredate,sal,comm,deptno) values (#{empno},#{ename},#{job},#{mgr},#{hiredate},#{sal},#{comm},#{deptno})")
    int save(Emp emp);

    //删除数据
    @Delete("delete from emp where empno=#{empno}")
    Integer delete(String empno);

    //根据员工编号查询
    @Select("select * from emp where empno=#{empno}")
    Emp get(String empno);

    //更新数据
    @Update("update emp set empno=#{empno},ename=#{ename},job=#{job},mgr=#{mgr},hiredate=#{hiredate},sal=#{sal},comm=#{comm},deptno=#{deptno} where empno=#{empno}")
    int update(Emp emp);
}
